package com.example.lesson_10_25.JAVAHW.H1127;

/**
 * @PACKAGE_NAME: com.example.lesson_10_25.JAVAHW.H1127
 * @NAME: Company
 * @USER: jiang000
 * @DATE: 2023/12/4
 **/
import java.util.ArrayList;
import java.util.List;

class Employee {
    private String name;
    private String businessScope;

    public Employee(String name, String businessScope) {
        this.name = name;
        this.businessScope = businessScope;
    }

    public String getName() {
        return name;
    }

    public String getBusinessScope() {
        return businessScope;
    }
}

class Department {
    private String name;
    private List<Employee> employees;

    public Department(String name) {
        this.name = name;
        this.employees = new ArrayList<>();
    }

    public String getName() {
        return name;
    }

    public void addEmployee(Employee employee) {
        employees.add(employee);
    }

    public List<Employee> getEmployees() {
        return employees;
    }
}

class Company {
    private String name;
    private List<Department> departments;

    public Company(String name) {
        this.name = name;
        this.departments = new ArrayList<>();
    }

    public String getName() {
        return name;
    }

    public void addDepartment(Department department) {
        departments.add(department);
    }

    public List<Department> getDepartments() {
        return departments;
    }
}

public class myCompany {
    public static void main(String[] args) {
        Employee employee1 = new Employee("John Doe", "Sales");
        Employee employee2 = new Employee("Jane Smith", "Marketing");

        Department salesDepartment = new Department("Sales");
        salesDepartment.addEmployee(employee1);

        Department marketingDepartment = new Department("Marketing");
        marketingDepartment.addEmployee(employee2);

        Company myCompany = new Company("ABC");
        myCompany.addDepartment(salesDepartment);
        myCompany.addDepartment(marketingDepartment);

        // Output company information
        System.out.println("Company Name: " + myCompany.getName());
        for (Department department : myCompany.getDepartments()) {
            System.out.println("  Department Name: " + department.getName());
            for (Employee employee : department.getEmployees()) {
                System.out.println("    Employee Name: " + employee.getName() +
                        ", Business Scope: " + employee.getBusinessScope());
            }
        }
    }
}

